home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 July / Chip Temmuz 2004.iso / program / code / Adobe Illustrator CS Tryout / data1.cab / Program_Files / Presets / Scripts / SaveDocsAsPDF.js < prev   
Encoding:
Text File  |  2004-01-07  |  859 b   |  32 lines

  1. // save front-most document as a PDF
  2.  
  3.  
  4.  
  5.  
  6.  
  7. //$.bp();    //    Uncomment this line to cause the script to be run in the JavaScript debugger window.
  8.  
  9.  
  10.  
  11.  
  12.  
  13. numDocuments = documents.length;
  14.  
  15.  
  16.  
  17.  
  18.  
  19. for ( i = 0 ; i < numDocuments; i++)
  20.  
  21.  
  22. {
  23.  
  24.  
  25.     aDocument = documents[i];
  26.  
  27.  
  28.     theDocumentName = aDocument.name;
  29.  
  30.  
  31.     
  32.  
  33.  
  34.     pdfSaveOptions = new PDFSaveOptions();
  35.  
  36.  
  37.     pdfSaveOptions.preserveEditability = true;
  38.  
  39.  
  40.  
  41.  
  42.  
  43.     docPath = aDocument.path;
  44.  
  45.  
  46.     docPathStr = docPath.toString();
  47.  
  48.  
  49.  
  50.  
  51.  
  52.     if (docPathStr.length > 1)
  53.  
  54.  
  55.     {
  56.  
  57.  
  58.         documentPath = aDocument.path + "/" + aDocument.name;        
  59.  
  60.  
  61.     }
  62.  
  63.  
  64.     else
  65.  
  66.  
  67.     {
  68.  
  69.  
  70.         // This is a brand new file and doesn't have a path yet,
  71.  
  72.  
  73.         // so put it in the illustrator application folder.
  74.  
  75.  
  76.         documentPath = path + "/" + aDocument.name;
  77.  
  78.  
  79.     }
  80.  
  81.  
  82.  
  83.  
  84.  
  85.     theFile = new File(documentPath);
  86.  
  87.  
  88.     aDocument.saveAs(theFile, pdfSaveOptions);
  89.  
  90.  
  91. }
  92.  
  93.  
  94.